/*
 * Copyright 2021 SkyAPM
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */


#ifndef SKYWALKING_SKY_PLUGIN_PREDIS_H
#define SKYWALKING_SKY_PLUGIN_PREDIS_H

#include "php_skywalking.h"

#include "sky_utils.h"
#include <string>
#include "span.h"

#define SKY_PREDIS_IS_PARAMETERS(p) SKY_IS_OBJECT(p) && sky_get_class_name(p) == "Predis\\Connection\\Parameters"

#define SKY_PREDIS_IS_STREAM_CONNECTION(c) SKY_IS_OBJECT(c) && sky_get_class_name(c) == "Predis\\Connection\\StreamConnection"
#define SKY_PREDIS_IS_ABSTRACT_CONNECTION(c) SKY_IS_OBJECT(c) && sky_get_class_name(c) == "Predis\\Connection\\AbstractConnection"


Span *sky_predis(zend_execute_data *execute_data, const std::string &class_name, const std::string &function_name);

std::string sky_predis_peer(zend_execute_data *execute_data);

std::string sky_predis_command(zval *id, zval *arguments);

#endif //SKYWALKING_SKY_PLUGIN_PREDIS_H
